{Common::js('layer2.0/layer.js')}
<a href="javascript:;" class="item sc {if Controller_Collect::is_exist(array('type_id'=>$typeid,'id'=>$info['id']))}active{/if}" id="collect_btn"><i class="icon"></i>收藏</a>
<script>
$('#collect_btn').click(function(){
    //未登录.跳转 
    {if !Model_Member_Login::check_login_info()}
         window.location.href="{$cmsurl}member/login?redirecturl="+encodeURIComponent(window.location.href);
         return true; 
    {/if}
    var add;
    var node=$(this);
    var data={type_id:'{$typeid}',id:'{$info["id"]}'}
    $.post('{$cmsurl}collect/modify',data,function(rs){
        if(node.hasClass('active')){
            add=false;
            node.removeClass('active');
        }else{
            add=true;
            node.addClass('active');
        }
        layer.open({
            content: add?'收藏成功':'取消收藏',
            skin: 'msg',
            time: 1.5
        });
    },'json');
});

</script>